Completion Function
When client programs schedule asynchronous read or write operations (by calling your component's
DataHScheduleData
or
DataHWrite
functions), they furnish your component a data-handler completion function. Your component must call this function when it completes the read or write operation, whether the operation was a success or a failure.
Data handler Completion Function
The client program's completion function must present the following interface:
pascal void DHCompleteProc (
Ptr request,
long refcon,
OSErr err);
-
request
-
Specifies a pointer to the data that was associated with the read (
DataHScheduleData
) or write (
DataHWrite
) request. The client program uses this pointer to determine which request has completed.
-
refcon
-
Contains a reference constant that the client program supplied to your data handler component when it made the original request.
-
err
-
Indicates the success or failure of the operation. If the operation succeeded, set this parameter to 0. Otherwise, specify an appropriate error code.
DISCUSSION
Data handler completion functions are guaranteed to be called at non-interrupt time. This means that you can safely call functions that are not interrupt-safe, such as
DataHScheduleData,
from within a completion function.
© 1999 Apple Computer, Inc.| Previous | Chapter Contents | Chapter Top |